<template>
    <svg aria-hidden :width="width" :height="height">
        <use :href="symbolId" :fill="color" />
    </svg>
</template>
<script setup name="LocalSvgIcon">
//vite-plugin-svg-icons 导入本地图标实现 此组件无法设置宽高 ,它是引用本地的svg文件,无法控
import { computed } from 'vue'

const props = defineProps({
    prefix: {
        type: String,
        default: 'icon'
    },
    name: {
        type: String,
        required: true
    },
    color: {
        type: String,
        default: 'currentColor' //继承父类的颜色
    },
    width: {
        type: String,
        default: '1em'
    },
    height: {
        type: [String],
        default: '1em'
    }
})

const symbolId = computed(() => `#${props.prefix}-${props.name}`)
</script>
